package com.example.util;

import com.example.entity.Userinfo;
import com.example.service.UserinfoService;
import org.springframework.beans.factory.annotation.Autowired;

public class LogoutThread extends Thread
{
    private Userinfo userinfo;
    private UserinfoService userinfoService;
    public LogoutThread(Userinfo userinfo,UserinfoService userinfoService)
    {
        this.userinfo = userinfo;
        this.userinfoService = userinfoService;
    }
    @Override
    public void run()
    {
        while (true)
        {
            try
            {
                sleep(5*60*1000);
                userinfoService.logout(this.userinfo);
            } catch (InterruptedException e)
            {
                e.printStackTrace();
            }
        }
    }
}
